/**
 * 颜色组件
 */
const { ccclass, property, disallowMultiple, menu, executionOrder, requireComponent } = cc._decorator;

@ccclass
@disallowMultiple()
@menu('自定义组件/ColorIndex')
export default class ColorIndex extends cc.Component {
     
    @property  private _index:number = 0;
    @property({tooltip: CC_DEV && '当前颜色下标',visible:true})
    
    set index(value:number) {
        if (value === this._index || value > this.colors.length) { 
            return;
        }  
        this._index = value % this.colors.length;
        this.node.color = this.colors[this._index];
    }
    
    get index() {
        return this._index;
    }

    @property([cc.Color])
    colors: cc.Color[] = [] ; 

   
}
